CSCI E-92: Application Note 22 CodeWarrior Segment Sizes ------------------------- Within our K70FN1M0 chip, we have 1M byte of program Flash and we have 128K bytes of static RAM. The addresses used to access this on-chip RAM are defined in the K70 Sub-Family Reference Manual, Rev. 4, Oct-2015 in Chapter 4: Memory Map. Table 4-1: System memory map on labeled page 199 (PDF page 206) for our Cortex-M4 core (M1) shows that, SRAM_L: Lower SRAM (ICODE/DCODE) for all masters is at addresses 0x1C00_0000-0x1FFF_FFFF SRAM_U: Upper SRAM (ICODE/DCODE) for all masters is at addresses 0x2000_0000-0x200F_FFFF For our K70FN1M0, the 128K bytes of static RAM is split equally between SRAM_L and SRAM_U. So, SRAM_L is at addresses 0x1FFF_0000-0x1FFF_FFFF and SRAM_U is at addresses 0x2000_0000-0x2000_FFFF. Therefore, in the K70, the address just past the end of RAM is 0x2001_0000. In CodeWarrior, the allocation of available RAM among the interrupt vector table, text, and data segments is defined in the MK70FN1M0_ram.ld file in the Linker_Files folder for each project. (Remember that the text segment is where code resides and the data segment is where data resides.) The initial configuration is, /* Specify the memory areas */ MEMORY { m_interrupts (rx) : ORIGIN = 0x1FFF0000, LENGTH = 0x1E8 m_text (rx) : ORIGIN = 0x1FFF01E8, LENGTH = 64K-0x1E8 /* Lower SRAM */ m_data (rw) : ORIGIN = 0x20000000, LENGTH = 64K /* Upper SRAM */ } The initial stack pointer is 0x2001_0000 -- just past the highest RAM address. The heap size is 0x800 and the stack size is 0x800. The heap is located just below the stack in memory. The above initial configuration has 64K-0x1E8 bytes for text and 64K bytes for data. It is possible change the amount of RAM available for the text and data segments by appropriately changing this file.